<?php
namespace Badmins\Model;
use Think\Model;
class WxImgtextModel extends Model{
	protected $_validate = array(
			array('title','require','标题必须'),
			array('big_img','require','大图片必须！'),
			array('small_img','require','小图片必须'),
			array('url','url','url链接填写错误',2),
			array('content','require','介绍必须'),
	);
	protected $_auto = array (
			array('content','ckcontent',3,'callback',1), 
			array('intro','ckintro',3,'callback',1),
	);
	public function ckcontent(){
		$content = $_POST['content'];
		if(!empty($content)){
			$url = "http://".$_SERVER['HTTP_HOST'];
			$content = replacePicUrl($content,$url);//添加url
			return $content;
		}
	}
	public function ckintro(){
		$intro = I('intro');
		if(!empty($intro)){
			return $intro;
		}else{
			$content = strip_tags($_POST['content']);
			return \Org\Util\String::msubstr($content,0,50);
		}
	}
}